var h = window.innerHeight;
var address = window.location.href.substring(window.location.href.indexOf('?') + 1).split('&');
var qzbhs = '',
    xxid = '',
    xh = '',
    imgNum = $('#allImg img').length;
$(document).ready(function() {
    $('.row-hook').css({height: h});
    $('.tabs').css({height: h - 20 + 'px'});
    $('.tab-1').css('height',h - 20 + 'px');
    $('.listDiv').css({height: h - 110 + 'px',overflow: 'auto'});
    $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
    $('.case-list').css('height', $('#case').height() - 33 + 'px');
    //附件查看
    $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});

    //上传
    $('.fileContainer').css('width',$('.fileEnclosures').width() - 35 + 'px');
    $('#yulan').css({width:$('.fileEnclosures .left').width() - 5 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
    $('#canvasShow').css({width:$('.fileEnclosures .left').width() - 5 + 'px', height: $('.fileEnclosures .left').height() + 'px'});
    $('.allMessageList').css('width',$('.fileEnclosures .right').width() + 'px');
    //textareaOnload();
    getMsg();
    $(window).resize(function(){
        h = window.innerHeight;
        $('.row-hook').css({height: h});
        $('.tabs').css({height: h - 20 + 'px'});
        $('.tab-1').css('height',h - 20 + 'px');
        $('.listDiv').css({height: h - 110 + 'px',overflow: 'auto'});
        $('.case-list').css('height', $('#case').height() - 33 + 'px');
        $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
        //附件查看
        $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});

        $('.lineSurvey').css({height: $('.tab-1').height() - 90 + 'px',overflow: 'auto'});
    })
    $('.marks').click(function(){
        $(this).hide();
    })

//取消默认右键事件
    document.oncontextmenu = function(){
        return false;
    }
})
function getMsg(){
    clearMsg();
    clearLineSurvey();//清除线勘数据
    $.ajax({
        type: 'get',
        url: baseUrls + 'case/detail',
        data: {ajbh: address[0],userid: address[1]},
        beforeSend: function(){
            Loading();
        },
        success: function(response){
            closeLoading();
            if (response.responseCode == "1000") {
                if(response.content.hasAttention == true){
                    $('.inFollow').css('display', 'none');
                    $('.unFollow').css('display', 'block');
                }else{
                    $('.inFollow').css('display', 'block');
                    $('.unFollow').css('display', 'none');
                }
                $('.ajbh-hoof').val(nulls(response.content.aj[0].ajbh));
                $('.afkssj-hoof').val(nulls(response.content.aj[0].afkssj ) + '  ~  ' + nulls(response.content.aj[0].afjssj));
                if(nulls(response.content.aj[0].afkssj ) == "无" && nulls(response.content.aj[0].afjssj) == "无"){
                    $('.afkssj-hoof').val('无');
                }
                $('.ajmc-hoof').val(nulls(response.content.aj[0].ajmc));
                $('.ajlb-hoof').val(nulls(response.content.aj[0].ajlb));
                $('.afdd-hoof').val(nulls(response.content.aj[0].afdd));
                $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr1) + '  ~  ' + nulls(response.content.aj[0].cjr2));
                if(nulls(response.content.aj[0].cjr1) == '无' && nulls(response.content.aj[0].cjr2) == '无'){
                    $('.cjr1-hoof').val('无');
                } else if(nulls(response.content.aj[0].cjr1) == '无'){
                    $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr2));
                } else{
                    $('.cjr1-hoof').val(nulls(response.content.aj[0].cjr1));
                }
                $('.gxr-hoof').val(nulls(response.content.aj[0].gxrxx));
                $('.ajlx-hoof').val(nulls(response.content.aj[0].ajlx));
                $('.jyaq-hoof').html(nulls(response.content.aj[0].jyaq));
                $('.rImg').html('');
                //案件基本信息 图片信息
                if(response.content.xs.tp.length > 0){
                    $('.infos').css({display: 'block'});
                    $('.introCase').css('height', '150px');
                    //案件基本信息 图片
                    var photoLength = 0;
                    for (var i = 0; i < response.content.xs.tp.length; i++) {
                        if(response.content.xs.tp[i].qzlx == 4 && response.content.xs.tp[i].wllj != null){
                            photoLength += 1;
                            $('.rImg').append('<div class="father"><em class="son"><img src="' + response.content.xs.tp[i].wllj + '"  onerror="nofind(this)" class="introImg"></em></div>');
                        }
                        if(photoLength >= 2){
                            break;
                        }
                    }
                    if( $('.rImg').html() == ''){
                        $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
                        $('.rImg').css('padding','0');
                    }else {
                        $('.message .msgR').css({flex: '0 0 500px', paddingLeft: '5px'});
                        $('.rImg').css('padding','5px');
                        $('.rImg').css({height: $('.msgL').height()});
                        $('.father').css({height: Math.floor($('.msgL').height() / 2)});
                        $('.father img').css({maxHeight: Math.floor($('.msgL').height() / 2)});
                    }
                    //附件
                    $('#allImg').html('');
                    $('.allFileMsg').html('');
                    $('#fileImg').css({width:$('.infoL').width() - 500 + 'px',overflow: 'hidden'});
                    for (var i = 0; i < response.content.xs.tp.length; i++) {
                        var fileMsgBuild = '';
                        if(response.content.xs.tp[i].tpylzd7 == '嫌疑人'){
                            var jrspsj = '';
                            if(response.content.xs.tp[i].jrspsj != null && response.content.xs.tp[i].jrspsj.length >= 0){
                                jrspsj = '<div class="group clearfix"><div class="form-group form-groups"><label>视频人物时间</label><input type="text" class="form-control Input" value="'+ nulls(response.content.xs.tp[i].jrspsj) +' ~ '+ nulls(response.content.xs.tp[i].lkspsj) +'" readonly></div></div>';
                            }
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group"><label>人数</label><input type="text" class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].rs) +'" readonly></div><div class="form-group"><label>年龄</label><input type="text" class="form-control Input fileTwo" value="'+ nulls(response.content.xs.tp[i].nl) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>性别</label><input type="text" class="form-control Input fileThree" value="'+ nulls(response.content.xs.tp[i].xb) +'" readonly></div><div class="form-group"><label>身高</label><input type="text" class="form-control Input fileFour" value="'+ nulls(response.content.xs.tp[i].sg) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣颜色</label><input type="text" class="form-control Input fileFive" value="'+ nulls(response.content.xs.tp[i].ssys) +'" readonly></div><div class="form-group"><label>上衣正面</label><input type="text" class="form-control Input fileSix" value="'+ nulls(response.content.xs.tp[i].sszm) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>上衣背面</label><input type="text" class="form-control Input fileSeven" value="'+ nulls(response.content.xs.tp[i].ssbm) +'" readonly></div><div class="form-group"><label>上衣侧面</label><input type="text" class="form-control Input fileEight" value="'+ nulls(response.content.xs.tp[i].sscm) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>上衣备注</label><input type="text" class="form-control Input fileEight" value="'+ nulls(response.content.xs.tp[i].ssbz) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身颜色</label><input type="text" class="form-control Input fileNine" value="'+ nulls(response.content.xs.tp[i].xsys) +'" readonly></div><div class="form-group"><label>下身正面</label><input type="text" class="form-control Input fileTen" value="'+ nulls(response.content.xs.tp[i].xszm) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>下身背面</label><input type="text" class="form-control Input fileEleven" value="'+ nulls(response.content.xs.tp[i].xsbm) +'" readonly></div><div class="form-group"><label>下身侧面</label><input type="text" class="form-control Input fileTwelve" value="'+ nulls(response.content.xs.tp[i].xscm) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>下身备注</label><input type="text" class="form-control Input fileThirteen" value="'+ nulls(response.content.xs.tp[i].xsbz) +'" readonly></div></div><div class="group clearfix"><div class="form-group"><label>鞋颜色</label><input type="text" class="form-control Input fileFourteen" value="'+ nulls(response.content.xs.tp[i].xys) +'" readonly></div><div class="form-group"><label>嫌疑人状态</label><input type="text" class="form-control Input filefifteen" value="'+ nulls(response.content.xs.tp[i].xyrzt) +'" readonly></div></div>'+ jrspsj +'</div>';
                        }else if(response.content.xs.tp[i].tpylzd7 == '车辆') {
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group"><label>车辆颜色</label><input type="text"class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].csys) +'" readonly></div><div class="form-group"><label>型号</label><input type="text"class="form-control Input fileTwo" value="'+ nulls(response.content.xs.tp[i].cllx) +'"  readonly></div></div><div class="group clearfix"><div class="form-group"><label>二轮车</label><input type="text"class="form-control Input fileThree" value="'+ nulls(response.content.xs.tp[i].elc) +'" readonly></div><div class="form-group"><label>二轮车颜色</label><input type="text"class="form-control Input fileFour" value="'+ nulls(response.content.xs.tp[i].elcys) +'" readonly></div></div><div class="group clearfix"><div class="form-group form-groups"><label>车牌</label><input type="text" class="form-control Input fileFive" value="'+ nulls(response.content.xs.tp[i].cphm) +'" readonly></div></div></div>';
                        }else if(response.content.xs.tp[i].tpylzd7 == '损失物品'){
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group form-groups"><label>损失物品说明</label><input type="text" class="form-control Input fileOne" value="'+ nulls(response.content.xs.tp[i].sswp) +'" readonly></div></div></div>';
                        }else{
                            fileMsgBuild = '<div class=""><div class="group clearfix"><div class="form-group form-groups"><label>缴获物品说明</label><input type="text" class="form-control Input fileOne"  value="'+ nulls(response.content.xs.tp[i].jhwp) +'" readonly></div></div></div>';
                        }
                        if(response.content.xs.tp[i].qzlx == 1){
                            $('#allImg').append('<img src="thread/img/video.jpg" onerror="nofind(this)" >');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad" >附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                        if(response.content.xs.tp[i].qzlx == 4){
                            $('#allImg').append('<img src="' + response.content.xs.tp[i].wllj + '" onerror="nofind(this)" ondblclick="openImg(\'' + response.content.xs.tp[i].wllj + '\')" style="cursor:pointer;">');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad">附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                        if(response.content.xs.tp[i].qzlx == 5){
                            $('#allImg').append('<img src="thread/img/other.jpg" onerror="nofind(this)" >');
                            $('.allFileMsg').append('<div class="fileMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value="' + nulls(response.content.xs.tp[i].tpylzd7) + '"></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补录信息</label><div class="enclosureT">'+ fileMsgBuild +'</div><a href="' + baseUrls + 'download?url=' + response.content.xs.tp[i].wllj + '" target="_blank" class="btn btn-success downLoad">附件下载</a><input type="hidden" value="' + response.content.xs.tp[i].gxlj + '"></div></div></div>');
                        }
                    };
                    imgNum = $('#allImg img').length;
                    $('.allImg img').css({width: $('#fileImg').width(),height: '300px'});
                    $('.allImg').css('width', $('.images').width() * imgNum + 'px');
                    $('.allFileMsg ').css('width', 500 * $('.allImg img').length + 'px');
                    $('.fileMsg').css({width: '500px'});

                }

                //线索数据填充
                if(response.content.xs.wz.length > 0){
                    $('.infos').css({display: 'block'});
                    $('.introCase').css('height','150px');
                    //案件存在线索读取线索内现勘数据
                    // 基本信息
                    //线索基本
                    $('#ajqy').val(nulls(response.content.xs.wz[0].ajqy));
                    $('#qzmc').val(nulls(response.content.xs.wz[0].qzmc));
                    $('#zagj').val(nulls(response.content.xs.wz[0].zagj));
                    $('#gjsm').val(nulls(response.content.xs.wz[0].gjsm));
                    $('#sjsbh').val(nulls(response.content.xs.wz[0].sjsbh));
                    $('#xm').val(nulls(response.content.xs.wz[0].xm));
                    $('#fx').val(nulls(response.content.xs.wz[0].fx));
                    $('#yzys').val(nulls(response.content.xs.wz[0].yzys));
                    $('#lx').val(nulls(response.content.xs.wz[0].lx));
                    $('#tx').val(nulls(response.content.xs.wz[0].tx));
                    $('#bz').val(nulls(response.content.xs.wz[0].bz));
                    $('#bzs').val(nulls(response.content.xs.wz[0].bz));
                    //线勘
                    $('#xzdxClue1').val(nulls(response.content.xs.wz[0].xzdxmsxl));
                    $('#xzdxClueDl1').val(nulls(response.content.xs.wz[0].xzdxms));
                    $('#zaddClue1').val(nulls(response.content.xs.wz[0].zadd));
                    $('#zasdClue1').val(nulls(response.content.xs.wz[0].zasdmsxl));
                    $('#zasdClueDl1').val(nulls(response.content.xs.wz[0].zasdms));
                    $('#qrflClueDl1').val(nulls(response.content.xs.wz[0].qrfsmsxl));
                    $('#qrflClue1').val(nulls(response.content.xs.wz[0].qrfsms));
                    $('#zackClue1').val(nulls(response.content.xs.wz[0].zackms));
                    $('#zarkClue1').val(nulls(response.content.xs.wz[0].zajkms));
                    //损失物品
                    $('#sl').val(nulls(response.content.xs.wz[0].sl));
                    $('#jzy').val(nulls(response.content.xs.wz[0].jzy));
                    $('#pm').val(nulls(response.content.xs.wz[0].pm));
                    $('#cp').val(nulls(response.content.xs.wz[0].cp));
                    $('#xh').val(nulls(response.content.xs.wz[0].xhxk));
                    $('#tzms').val(nulls(response.content.xs.wz[0].tzmsxk));

                }else{
                    //读取现勘内现勘数据
                    //现勘
                    if(response.content.xk.fx.length > 0){
                        $('.infos').css({display: 'block'});
                        $('.introCase').css('height','150px');
                        $('#xzdxClue1').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#xzdxClueDl1').val(nulls(response.content.xk.fx[0].xzdxms));
                        $('#zaddClue1').val(nulls(response.content.xk.fx[0].zadd));
                        $('#zasdClue1').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#zasdClueDl1').val(nulls(response.content.xk.fx[0].zasdms));
                        $('#qrflClue1').val(nulls(response.content.xk.fx[0].qrfsms));
                        $('#qrflClueDl1').val(nulls(response.content.xk.fx[0].qrfsms));
                        $('#zackClue1').val(nulls(response.content.xk.fx[0].zackms));
                        $('#zarkClue1').val(nulls(response.content.xk.fx[0].zajkms));
                    }
                    //物品
                    if(response.content.xk.wp.length > 0){
                        $('.infos').css({display: 'block'});
                        $('.introCase').css('height','150px');
                        $('#sl').val(nulls(response.content.xk.wp[0].sl));
                        $('#jzy').val(nulls(response.content.xk.wp[0].jzy));
                        $('#pm').val(nulls(response.content.xk.wp[0].pm));
                        $('#cp').val(nulls(response.content.xk.wp[0].cp));
                        $('#xh').val(nulls(response.content.xk.wp[0].xh));
                        $('#tzms').val(nulls(response.content.xk.wp[0].tzms));

                    }
                }
            } else {
                Msg();
            }
        },
        error:function(){
            closeLoading();
            Msg();
        }
    })
}
function nulls(item){
    var callback;
    if(item != null && item != undefined){
        callback = item;
    } else {
        callback = '无';
    }
    return callback;
}
function clearMsg(){
    qzbhs = '';
    xxid = '';
    xh = '';
    ajbh = '';
    ajmc = '';

    //初始化右侧
    $('.infos').css({display: 'none'});
    $('.introCase').css('height',$('.listDiv').height() - $('.minH').height() - 5 + 'px');
    $('.tab-3 h3 .spanLeft').html('线索录入');
    //清除案件基本信息
    $('.ajbh-hoof').val('');
    $('.afkssj-hoof').val('');
    $('.ajmc-hoof').val('');
    $('.ajlb-hoof').val('');
    $('.afkssj-hoof').val('');
    $('.afdd-hoof').val('');
    $('.cjr1-hoof').val('');
    $('.gxr-hoof').val('');
    $('.ajlx-hoof').val('');
    $('.afjssj-hoof').val('');
    $('.cjr2-hoof').val('');
    $('.jyaq-hoof').html('');
    $('.rImg').html('');
    $('.message .msgR').css({flex: '0 0 0', paddingLeft: '0'});
    $('.rImg').css('padding','0');
    //清除线索信息
    $('#allImg').html('');
    $('.allFileMsg').html('');
    $('#allImg').append('<img src="../common/img/nothing.png" alt="图片丢失" onerror="nofind(this)">');
    $('.allFileMsg').append('<div class="fileMsg fileTextMsg"><div class="group clearfix"><div class="form-group form-groups"><label>文件说明</label><input type="text" class="form-control Input" readonly value=""></div></div><div class="group clearfix"><div class="form-group form-groups"> <label>补充说明</label><textarea class="form-control enclosureT" readonly style="height: 260px !important;"></textarea></div></div></div>');
    $('.fileMsg').css('width', $('.infoR').width() + 'px');
    $('.allFileMsg').css('width', $('.infoR').width() * $('.fileMsg').length + 'px');
    $('.allFileMsg ').css('margin-left', 0);
    $('.allImg').css('margin-left', 0);
    $('.infos').css({display: 'none'});
    imgNum = 0;

    $('#ajqy').val('');
    $('#qzmc').val('');
    $('#zagj').val('');
    $('#gjsm').val('');
    $('#sjsbh').val('');
    $('#xm').val('');
    $('#fx').val('');
    $('#yzys').val('');
    $('#lx').val('');
    $('#tx').val('');

    $('#xzdxClue1').val('');
    $('#xzdxClueDl1').val('');
    $('#zaddClue1').val('');
    $('#zasdClue1').val('');
    $('#zasdClueDl1').val('');
    $('#qrflClue1').val('');
    $('#qrflClueDl1').val('');
    $('#zarkClue1').val('');
    $('#zackClue1').val('');

    $('#sl').val('');
    $('#jzy').val('');
    $('#pm').val('');
    $('#cp').val('');
    $('#xh').val('');
    $('#tzms').val('');
    $('#bz').val('');
}
function openImg(src){
    $('.marks').html('');
    $('.marks').css('display','table');
    $('.marks').append('<span style="display:table-cell;vertical-align: middle;"><img src="'+ src +'" alt="图片丢失"  onerror="nofind(this)" class="addImg"></span>');
}
function nofind(item){
    item.src = '../common/img/nothing.png';
    item.onerror = null;
}
//现勘数据textarea
function textarea(item){
    $(item).parent().find('pre').html($(item).val());
    $(item).css({height: $(item).parent().find('pre').height() + 'px'});
    $(item).parent().find('label').css({height: $(item).parent().find('pre').height() + 'px',lineHeight: $(item).parent().find('pre').height() + 'px'})
}
function clearLineSurvey(){
    $('.listTitleUl li').eq(0).removeClass('liNormal').addClass('liActive').siblings().removeClass('liActive').addClass('liNormal');
    $('.listDiv>div').css('display','none');
    $('.listDiv>div').eq(0).css('display','block');
    $('.listDiv>div').eq(0).children('.message').css('display','flex');

    $('.caseTarget-hoof').val('');
    $('.caseTargetAdress-hoof').val('');
    $('.caseTargetTime-hoof').val('');
    $('.caseTacaseTargetEntrancerget-hoof').val('');
    $('.caseTargetHands-hoof').val('');

    $('.caseInquest-hoof').val('');
    $('.caseAddress-hoof').val('');
    $('.caseWeather-hoof').val('');
    $('.caseScene-hoof').val('');
    $('.caseLight-hoof').val('');
    $('.caseFlip-hoof').val('');
    $('.caseProtectTime-hoof').val('');
    $('.caseProtectPeople-hoof').val('');
    $('.caseProtectMode-hoof').val('');
    $('.caseInspect-hoof').val('');
    $('.caseLost-hoof').val('');
    $('.caseReport-hoof').val('');
    $('.caseLegacy-hoof').val('');
    $('.caseSuggest-hoof').val('');
    $('.caseCommand-hoof').val('');
    $('.caseInspectPeople-hoof').val('');
    $('.caseOther-hoof').val('');

    $('.acceptanceNumber-hoof').val('');
    $('.caseNumber-hoof').val('');
    $('.caseStyle-hoof').val('');
    $('.crimeZone-hoof').val('');
    $('.caseAdress-hoof').val('');
    $('.caseTime-hoof').val('');
    $('.caseHomicide-hoof').val('');
    $('.caseCriminal-hoof').val('');
    $('.caseSolveTime-hoof').val('');
    $('.latitudeLongitude-hoof').val('');
    $('.caseProcess-hoof').val('');

    $('.goodsContent-hoof').html('');
    $('.witnessContent-hoof').html('');
}

/**
 * Created by Administrator on 2017/7/23.
 */
var nowIndexs = 0,
    addList = [];
$('#fileImg').mouseenter(function(){
    if(imgNum > 1){
        $('.arrow').fadeIn();
    }
});
$('#fileImg').mouseleave(function(){
    $('.arrow').fadeOut();
})

$('.fileEnclosures').mouseenter(function(){
    if(sendMsg.length > 1){
        $('.arrow').fadeIn();
    }
    if(sendMsg.length > 0){
        $('#del').fadeIn();
    }
});
$('.fileEnclosures').mouseleave(function(){
    $('.arrow').fadeOut();
    $('#del').fadeOut();
})
function carousel(obj){
    if(obj === 'next'){
        nowIndexs += 1;
        if(nowIndexs >= imgNum){
            nowIndexs = 0;
        }
        $('#allImg').stop().animate({
            marginLeft: -nowIndexs * $('#fileImg').width()
        }, 500);
        $('.allFileMsg').stop().animate({
            marginLeft: -nowIndexs * 500
        }, 500);
    }else{
        nowIndexs -= 1;
        if(nowIndexs < 0){
            nowIndexs = imgNum -1;
        }
        $('#allImg').stop().animate({
            marginLeft: -nowIndexs * $('#fileImg').width()
        }, 500);
        $('.allFileMsg').stop().animate({
            marginLeft: -nowIndexs * 500
        }, 500);
    }
}

function changePattern(item){
    var Index = $(item).index();
    if( address[0] != ''){
        $(item).removeClass('liNormal').addClass('liActive').siblings().removeClass('liActive').addClass('liNormal');
        $('.listDiv>div').css('display','none');
        $('.listDiv>div').eq(Index).css('display','block');
        $('.lineSurvey').css({height: $('.tab-1').height() - 90 + 'px',overflow: 'auto'});
        if(Index == 1){
            //线勘数据查询
            if($.trim($('.casePolice-hoof').val()).length == 0){
                $.ajax({
                    type: 'get',
                    url: baseUrls + 'survey/'+ address[0],
                    // url: baseUrls + 'survey/A5202015100002017080038',
                    beforeSend: function(){
                        Loading();
                    },
                    success: function(response){
                        closeLoading();
                        if(response.responseCode == '1000'){
                            //案件基本信息
                            if(response.content.ajList.length > 0){
                                $('.acceptanceNumber-hoof').val(Nulls(response.content.ajList[0].ajslh));
                                $('.caseNumber-hoof').val(Nulls(response.content.ajList[0].ajbh));
                                $('.caseStyle-hoof').val(Nulls(response.content.ajList[0].ajlb));
                                $('.crimeZone-hoof').val(Nulls(response.content.ajList[0].faqh));
                                $('.caseAdress-hoof').val(Nulls(response.content.ajList[0].fadd));
                                $('.caseTime-hoof').val(Nulls(response.content.ajList[0].fasjq) + ' ~ ' + Nulls(response.content.ajList[0].fasjz));
                                if(response.content.ajList[0].fasjq == null && response.content.ajList[0].fasjz == null){
                                    $('.caseTime-hoof').val('');
                                };
                                if(response.content.ajList[0].sfma == 0){
                                    $('.caseHomicide-hoof').val('是');
                                }else{
                                    $('.caseHomicide-hoof').val('否');
                                }
                                if(response.content.ajList[0].sfxa == 0){
                                    $('.caseCriminal-hoof').val('是');
                                }else{
                                    $('.caseCriminal-hoof').val('否');
                                }
                                $('.caseSolveTime-hoof').val(Nulls(response.content.ajList[0].pasj));
                                $('.latitudeLongitude-hoof').val(Nulls(response.content.ajList[0].jd)+ ' | ' + Nulls(response.content.ajList[0].wd));
                                if(response.content.ajList[0].jd == null && response.content.ajList[0].wd == null){
                                    $('.latitudeLongitude-hoof').val('');
                                };
                                $('.caseProcess-hoof').val(Nulls(response.content.ajList[0].ajfxgc));
                            }else{
                                $('.acceptanceNumber-hoof').val('');
                                $('.caseNumber-hoof').val('');
                                $('.caseStyle-hoof').val('');
                                $('.crimeZone-hoof').val('');
                                $('.caseAdress-hoof').val('');
                                $('.caseTime-hoof').val('');
                                $('.caseHomicide-hoof').val('');
                                $('.caseCriminal-hoof').val('');
                                $('.caseSolveTime-hoof').val('');
                                $('.latitudeLongitude-hoof').val('');
                                $('.caseProcess-hoof').val('');
                            }
                            //现场信息 线勘
                            if(response.content.xcxxList.length > 0){
                                $('.caseInquest-hoof').val(Nulls(response.content.xcxxList[0].kysjks)+ ' ~ ' +Nulls(response.content.xcxxList[0].kysjjs));
                                if(response.content.xcxxList[0].kysjks == null && response.content.xcxxList[0].kysjjs == null){
                                    $('.caseInquest-hoof').val('');
                                };
                                $('.caseAddress-hoof').val(Nulls(response.content.xcxxList[0].kydd));
                                if(response.content.xcxxList[0].tqqk == '2'){
                                    $('.caseWeather-hoof').val('晴');
                                }
                                if(response.content.xcxxList[0].xctj == '2'){
                                    $('.caseScene-hoof').val('无');
                                }
                                if(response.content.xcxxList[0].gztj == '1'){
                                    $('.caseLight-hoof').val('亮');
                                }
                                if(response.content.xcxxList[0].xcwpfd == '4'){
                                    $('.caseFlip-hoof').val('整齐');
                                }
                                $('.caseProtectTime-hoof').val(Nulls(response.content.xcxxList[0].bhsj));
                                $('.caseProtectPeople-hoof').val(Nulls(response.content.xcxxList[0].bhrxm));
                                $('.caseProtectMode-hoof').val(Nulls(response.content.xcxxList[0].bhcs));
                                $('.caseInspect-hoof').val(Nulls(response.content.xcxxList[0].kyjcqk));
                                if(response.content.xcxxList[0].swqks == '4'){
                                    $('.caseLost-hoof').val('无伤亡');
                                }
                                // $('.caseReport-hoof').val(Nulls(response.content.xcxxList[0].bhdw)); 暂无数据
                                $('.caseLegacy-hoof').val(Nulls(response.content.xcxxList[0].xcylw));
                                $('.caseSuggest-hoof').val(Nulls(response.content.xcxxList[0].xcczyjwz));
                                $('.caseCommand-hoof').val(Nulls(response.content.xcxxList[0].xczhry));
                                $('.caseInspectPeople-hoof').val(Nulls(response.content.xcxxList[0].kyjcry));
                                $('.caseOther-hoof').val(Nulls(response.content.xcxxList[0].qtddxcry));
                            }else{
                                $('.caseInquest-hoof').val('');
                                $('.caseAddress-hoof').val('');
                                $('.caseWeather-hoof').val('');
                                $('.caseScene-hoof').val('');
                                $('.caseLight-hoof').val('');
                                $('.caseFlip-hoof').val('');
                                $('.caseProtectTime-hoof').val('');
                                $('.caseProtectPeople-hoof').val('');
                                $('.caseProtectMode-hoof').val('');
                                $('.caseInspect-hoof').val('');
                                $('.caseLost-hoof').val('');
                                $('.caseReport-hoof').val('');
                                $('.caseLegacy-hoof').val('');
                                $('.caseSuggest-hoof').val('');
                                $('.caseCommand-hoof').val('');
                                $('.caseInspectPeople-hoof').val('');
                                $('.caseOther-hoof').val('');
                            }
                            //线勘报警基本信息
                            if(response.content.cjList.length > 0){
                                $('.casePolice-hoof').val(Nulls(response.content.cjList[0].jksj));
                                $('.caseComputer-hoof').val(Nulls(response.content.cjList[0].zpdw));
                                $('.caseReason-hoof').val(Nulls(response.content.cjList[0].kysy));
                            }else{
                                $('.casePolice-hoof').val('');
                                $('.caseComputer-hoof').val('');
                            }
                            //损失物品
                            $('.goodsContent-hoof').html('');
                            if(response.content.ssList.length > 0){
                                for(var i = 0; i < response.content.ssList.length; i++){
                                    $('.goodsContent-hoof').append('<li><strong>'+ (i + 1) +'</strong><strong title="'+ nulls(response.content.ssList[i].pm) +'">'+ nulls(response.content.ssList[i].pm) +'</strong><strong title="'+ nulls(response.content.ssList[i].cp)+ '  ' + nulls(response.content.ssList[i].xh) +'">'+ nulls(response.content.ssList[i].cp)+ '  ' + nulls(response.content.ssList[i].xh) +'</strong><strong title="'+ nulls(response.content.ssList[i].tzms) +'">'+ nulls(response.content.ssList[i].tzms) +'</strong><strong title="'+ nulls(response.content.ssList[i].sl) +'">'+ nulls(response.content.ssList[i].sl) +'</strong><strong title="'+ nulls(response.content.ssList[i].jzy) +'">'+ nulls(response.content.ssList[i].jzy) +'</strong></li>');
                                }
                            }
                            //受害人
                            $('.witnessContent-hoof').html('');
                            if(response.content.bhrList.length > 0){
                                for(var i = 0; i < response.content.bhrList.length; i++){
                                    $('.witnessContent-hoof').append('<li><strong>'+ (i + 1) +'</strong><strong title="'+ nulls(response.content.bhrList.xm) +'">'+ nulls(response.content.bhrList.xm) +'</strong><strong title="'+ nulls(response.content.bhrList.xb) +'">'+ nulls(response.content.bhrList.xb) +'</strong><strong title="'+ nulls(response.content.bhrList.nl) +'">'+ nulls(response.content.bhrList.nl) +'</strong><strong title="'+ nulls(response.content.bhrList.xzzxz) +'">'+ nulls(response.content.bhrList.xzzxz) +'</strong></li>');
                                }
                            }
                            //分析意见
                            if(response.content.fxList.length > 0){
                                $('.caseTarget-hoof').val(Nulls(response.content.fxList[0].xzdxms));
                                $('.caseTargetAdress-hoof').val(Nulls(response.content.fxList[0].zadd));
                                $('.caseTargetTime-hoof').val(Nulls(response.content.fxList[0].zasdms));
                                $('.caseTargetEntrance-hoof').val('进口：'+ nulls(response.content.fxList[0].zajkms) + ';' + '出口：' + nulls(response.content.fxList[0].zackms));
                                $('.caseTargetHands-hoof').val('窃取手段：'+ nulls(response.content.fxList[0].zagjms) + ';' + '侵入方式：' + nulls(response.content.fxList[0].qrfsms));
                            }else{
                                $('.caseTarget-hoof').val('');
                                $('.caseTargetAdress-hoof').val('');
                                $('.caseTargetTime-hoof').val('');
                                $('.caseTacaseTargetEntrancerget-hoof').val('');
                                $('.caseTargetHands-hoof').val('');
                            }
                        }else{
                            Msg();
                        }
                    },
                    error: function(){
                        closeLoading();
                        Msg();
                    }
                })
            }
        }else{

        }
    }else{
        Msg('请先选择案件');
    }
}
function Nulls(item){
    var callback;
    if(item != null && item != undefined){
        callback = item;
    } else {
        callback = '';
    }
    return callback;
}
function follow(event){
    if(address[0] != ''){
        $.ajax({
            type: 'post',
            url: baseUrls + 'attention/add',
            data: {yhm: address[1],ajbh: address[0]},
            beforeSend: function (){
                Loading();
            },
            success:function(response){
                closeLoading();
                if(response.responseCode == '1000'){
                    Msg('关注成功');
                    $('.inFollow').css('display', 'none');
                    $('.unFollow').css('display', 'block');
                }else{
                    Msg('关注失败');
                }
            },
            error: function(){
                closeLoading();
                Msg('关注失败');
            }
        })
    }else{
        Msg('请先选择案件');
    }
}
